﻿@model GameSchoolApplication.Models.StudentTestPoints

@{
    ViewBag.Title = "Próf";
    Layout = "~/Views/Shared/_StudentLayout.cshtml";
}

<h2>@Model.Test.TestName</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@if (Model.Id != 0)
{ 
    <p>Þú hefur þegar svarað prófinu.</p>
}
else if(DateTime.Now > Model.LevelEntry.StartedAt.AddDays(Model.Test.Days))
{
    <p>Því miður, skilatíminn er útrunninn.</p>
}
else
{
    using (Html.BeginForm())
    {
        @Html.ValidationSummary(true)
        <fieldset>
            <legend></legend>
            @Html.HiddenFor(model => model.TestId)
            
            <p>Tími eftir í skil: @ViewBag.TimeLeft.Days dagar, @ViewBag.TimeLeft.Hours tímar, @ViewBag.TimeLeft.Minutes mínútur</p>
            
            <ol class="test">
                @Html.EditorFor(model => model.StudentAnswers)
            </ol>

            <p>
                <input type="submit" value="Skila" />
            </p>
        </fieldset>
    }
}
<div>
    @Html.ActionLink("Til baka í lista", "Active", "Level", new { gameId = Model.Test.Level.GameId }, new { })
</div>
